package com.mms.action.minutes;

import java.sql.Timestamp;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.mms.dao.MinutesDao;
import com.mms.entity.Meeting;
import com.mms.entity.MinutesString;
import com.mms.util.MyMeetingInfo;
import com.opensymphony.xwork2.Action;

public class AddMinStringAction implements Action{

	private String diu;
	private String addTopic;
	private String addDate;
	
	
	public String getDiu() {
		return diu;
	}


	public void setDiu(String diu) {
		this.diu = diu;
	}


	public String getAddTopic() {
		return addTopic;
	}


	public void setAddTopic(String addTopic) {
		this.addTopic = addTopic;
	}


	public String getAddDate() {
		return addDate;
	}


	public void setAddDate(String addDate) {
		this.addDate = addDate;
	}


	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		HttpServletRequest request=ServletActionContext.getRequest();
	    request.setCharacterEncoding("UTF-8");
	    request=MyMeetingInfo.getMyMeetingInfo(request);
	    
		String s0 = diu.replace("<p>","");
		String s1 = s0.replace("</p>","");
		MinutesDao md = new MinutesDao();
		MinutesString minute = new MinutesString();
		Meeting meeting = new Meeting();
		minute.setMinString(s1);
		minute.setMinSubmitTime(Timestamp.valueOf(addDate+":00"));
		meeting.setTopic(addTopic);
		minute.setMeeting(meeting);
		System.out.println("---------------->"+s1);
		System.out.println("---------------->"+addTopic);
		System.out.println("---------------->"+addDate);
		md.addMinutesStr(minute);
		return "success";
	}

	
}
